package com.sp.transformation;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * 中文乱码现象
 */
public class CodeQuestion {
    public static void main(String[] args) throws IOException {
        //读取文件到程序
        //1. 创建字符输入流 BufferedReader[处理流]
        //2. 使用BufferedReader对象读取a.txt
        //3. 默认情况下, 读取文件是按照utf-8编码, 读取ANSI编码中的中文就会乱码
        String filePath = "d:\\development\\code\\IO_Test\\news\\story2.txt";
        BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));

        String s = bufferedReader.readLine();
        System.out.println("读取到的内容: " + s);
        bufferedReader.close();
    }
}
